<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>注册 - 指针平台</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.2.3/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
    <style>
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background-color: #f8f9fa;
            height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        .register-container {
            background-color: white;
            border-radius: 12px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
            overflow: hidden;
            max-width: 900px;
            width: 100%;
            margin: auto;
        }
        
        .left-section {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 40px;
            display: flex;
            flex-direction: column;
            justify-content: center;
        }
        
        .left-section h2 {
            font-size: 24px;
            font-weight: 600;
            margin-bottom: 20px;
        }
        
        .left-section p {
            font-size: 14px;
            opacity: 0.9;
            margin-bottom: 30px;
        }
        
        .illustration {
            text-align: center;
            margin-top: 20px;
        }
        
        .illustration svg {
            max-width: 100%;
            height: auto;
        }
        
        .right-section {
            padding: 40px;
        }
        
        .right-section h3 {
            font-size: 20px;
            font-weight: 600;
            margin-bottom: 30px;
            color: #333;
        }
        
        .form-group {
            margin-bottom: 20px;
        }
        
        .form-group label {
            font-size: 14px;
            color: #666;
            margin-bottom: 8px;
        }
        
        .form-control {
            border: 1px solid #e0e0e0;
            border-radius: 6px;
            padding: 12px 15px;
            font-size: 14px;
            transition: border-color 0.3s;
        }
        
        .form-control:focus {
            border-color: #667eea;
            box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
        }
        
        .input-group-text {
            background-color: transparent;
            border: 1px solid #e0e0e0;
            border-right: none;
            border-radius: 6px 0 0 6px;
            color: #666;
        }
        
        .input-group .form-control {
            border-left: none;
            border-radius: 0 6px 6px 0;
        }
        
        .btn-primary {
            background-color: #667eea;
            border: none;
            border-radius: 6px;
            padding: 12px;
            font-size: 16px;
            font-weight: 500;
            transition: background-color 0.3s;
        }
        
        .btn-primary:hover {
            background-color: #5a6fe0;
        }
        
        .form-footer {
            margin-top: 20px;
            text-align: center;
            font-size: 14px;
            color: #666;
        }
        
        .form-footer a {
            color: #667eea;
            text-decoration: none;
        }
        
        .form-footer a:hover {
            text-decoration: underline;
        }
        
        .toggle-password {
            cursor: pointer;
        }
        
        .messages {
            margin-bottom: 20px;
        }
        
        .alert {
            border-radius: 6px;
            font-size: 14px;
        }
        
        .form-check {
            margin-bottom: 20px;
        }
        
        .form-check-label {
            font-size: 14px;
            color: #666;
        }
    </style>
</head>
<body>
    <div class="register-container row g-0">
            <!-- 左侧部分 -->
            <div class="left-section col-md-5 d-none d-md-block">
                <h2>欢迎加入指针平台<br>共创智慧校园</h2>
                <p>简单注册，即刻体验全新的智能校园服务</p>
                <div class="illustration">
                    <!-- 这里可以放置SVG图像 -->
                    <svg width="300" height="250" viewBox="0 0 100 80" fill="none" xmlns="http://www.w3.org/2000/svg">
                        <circle cx="50" cy="40" r="35" fill="rgba(255,255,255,0.1)"/>
                        <path d="M30 30 L70 30" stroke="white" stroke-width="3" stroke-linecap="round"/>
                        <path d="M30 45 L55 45" stroke="white" stroke-width="3" stroke-linecap="round"/>
                        <circle cx="30" cy="60" r="3" fill="white"/>
                        <circle cx="50" cy="60" r="3" fill="white"/>
                        <circle cx="70" cy="60" r="3" fill="white"/>
                    </svg>
                </div>
            </div>
            
            <!-- 右侧部分 -->
            <div class="right-section col-md-7">
                <h3>注册账号</h3>
                
                <!-- 消息提示 -->
                {% if messages %}
                <div class="messages">
                    {% for message in messages %}
                    <div class="alert alert-{% if message.tags %}{{ message.tags }}{% else %}info{% endif %}">
                        {{ message }}
                    </div>
                    {% endfor %}
                </div>
                {% endif %}
                
                <!-- 注册表单 -->
                <form method="post" action="{% url 'register' %}">
                    {% csrf_token %}
                    <div class="form-group">
                        <label for="username">用户名</label>
                        <div class="input-group">
                            <span class="input-group-text">
                                <i class="fas fa-user"></i>
                            </span>
                            <input type="text" class="form-control" id="username" name="username" placeholder="请设置用户名" required>
                        </div>
                    </div>
                    
                    <div class="form-group">
                        <label for="phone">手机号（选填）</label>
                        <div class="input-group">
                            <span class="input-group-text">
                                <i class="fas fa-mobile-alt"></i>
                            </span>
                            <input type="tel" class="form-control" id="phone" name="phone" placeholder="请输入手机号码">
                        </div>
                    </div>
                    
                    <div class="form-group">
                        <label for="email">邮箱地址（选填）</label>
                        <div class="input-group">
                            <span class="input-group-text">
                                <i class="fas fa-envelope"></i>
                            </span>
                            <input type="email" class="form-control" id="email" name="email" placeholder="请输入邮箱地址">
                        </div>
                    </div>
                    
                    <div class="form-group">
                        <label for="password">密码</label>
                        <div class="input-group">
                            <span class="input-group-text">
                                <i class="fas fa-lock"></i>
                            </span>
                            <input type="password" class="form-control" id="password" name="password" placeholder="请设置密码" required>
                            <span class="input-group-text toggle-password" data-target="password">
                                <i class="fas fa-eye"></i>
                            </span>
                        </div>
                    </div>
                    
                    <div class="form-group">
                        <label for="confirm_password">确认密码</label>
                        <div class="input-group">
                            <span class="input-group-text">
                                <i class="fas fa-lock"></i>
                            </span>
                            <input type="password" class="form-control" id="confirm_password" name="confirm_password" placeholder="请再次输入密码" required>
                            <span class="input-group-text toggle-password" data-target="confirm_password">
                                <i class="fas fa-eye"></i>
                            </span>
                        </div>
                    </div>
                    
                    <div class="form-check">
                        <input type="checkbox" class="form-check-input" id="terms" required>
                        <label class="form-check-label" for="terms">
                            我已阅读并同意 <a href="#">用户协议</a> 和 <a href="#">隐私政策</a>
                        </label>
                    </div>
                    
                    <button type="submit" class="btn btn-primary w-100">注册</button>
                    
                    <div class="form-footer">
                        已有账号？ <a href="{% url 'login' %}">立即登录</a>
                    </div>
                </form>
            </div>
        </div>
    </div>
    
    <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.2.3/js/bootstrap.bundle.min.js"></script>
    <script>
        // 密码显示/隐藏切换
        document.querySelectorAll('.toggle-password').forEach(button => {
            button.addEventListener('click', function() {
                const targetId = this.getAttribute('data-target');
                const passwordInput = document.getElementById(targetId);
                const icon = this.querySelector('i');
                
                if (passwordInput.type === 'password') {
                    passwordInput.type = 'text';
                    icon.classList.remove('fa-eye');
                    icon.classList.add('fa-eye-slash');
                } else {
                    passwordInput.type = 'password';
                    icon.classList.remove('fa-eye-slash');
                    icon.classList.add('fa-eye');
                }
            });
        });
    </script>
</body>
</html>